package ATM.gui;

import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.text.JTextComponent;

public class CalculateInterest extends JPanel {
	private JTextField TFLoanAmount;
	private JTextField TFMonthlyRate;
	private ButtonGroup LoanGroup;
	private Screen screen;
	private int interest;
	private JLabel lblInterestIs;

	public CalculateInterest(Screen screen) {

		this.screen = screen;
		setLayout(null);

		JLabel lblCalculateInterest = new JLabel("Calculate Interest");
		lblCalculateInterest.setBounds(95, 11, 118, 14);
		add(lblCalculateInterest);

		JLabel lblChoseLoanType = new JLabel("Chose loan type:");
		lblChoseLoanType.setBounds(40, 50, 129, 14);
		add(lblChoseLoanType);

		JRadioButton rdbtnCarLoan = new JRadioButton("Car loan");
		rdbtnCarLoan.setBounds(40, 71, 109, 23);
		add(rdbtnCarLoan);

		JRadioButton rdbtnHouseLoan = new JRadioButton("House loan");
		rdbtnHouseLoan.setBounds(40, 97, 109, 23);
		add(rdbtnHouseLoan);

		// relationship between JRadioButtons
		LoanGroup = new ButtonGroup();
		LoanGroup.add(rdbtnHouseLoan);
		LoanGroup.add(rdbtnCarLoan);

		lblInterestIs = new JLabel("Interest is \" kode\"");
		lblInterestIs.setBounds(40, 197, 109, 14);
		add(lblInterestIs);

		JLabel lblChoseLoanAmount = new JLabel("Type loan amount");
		lblChoseLoanAmount.setBounds(179, 50, 109, 14);
		add(lblChoseLoanAmount);

		TFLoanAmount = new JTextField();
		TFLoanAmount.setBounds(179, 72, 86, 20);
		add(TFLoanAmount);
		TFLoanAmount.setColumns(10);

		JLabel lblTypeMonthlyRate = new JLabel("Type monthly rate");
		lblTypeMonthlyRate.setBounds(298, 50, 118, 14);
		add(lblTypeMonthlyRate);

		TFMonthlyRate = new JTextField();
		TFMonthlyRate.setBounds(298, 72, 86, 20);
		add(TFMonthlyRate);
		TFMonthlyRate.setColumns(10);

		JButton btnIntEnter = new JButton("Enter");
		btnIntEnter.setBounds(327, 97, 89, 38);
		add(btnIntEnter);
		btnIntEnter.setActionCommand("CalculateEnter");
		btnIntEnter.addActionListener(screen.getAdminaL());

		JLabel lblLoanTypekode = new JLabel("Loan type \"kode\"");
		lblLoanTypekode.setBounds(40, 175, 109, 14);
		add(lblLoanTypekode);

		JLabel lblTheLoanIs = new JLabel("The loan is paid back in:");
		lblTheLoanIs.setBounds(179, 175, 142, 14);
		add(lblTheLoanIs);

		JLabel lblTheTotalPrice = new JLabel("The total price will be:");
		lblTheTotalPrice.setBounds(179, 200, 109, 14);
		add(lblTheTotalPrice);

	}

	public JTextField getTFLoanAmount() {
		return TFLoanAmount;
	}

	public void setTFLoanAmount(JTextField tFLoanAmount) {
		TFLoanAmount = tFLoanAmount;
	}

	public JTextField getTFMonthlyRate() {
		return TFMonthlyRate;
	}

	public void setTFMonthlyRate(JTextField tFMonthlyRate) {
		TFMonthlyRate = tFMonthlyRate;
	}

	public int getInterest() {
		return interest;
	}

	public JLabel getLblInterestIs() {
		return lblInterestIs;
	}

	public void setLblInterestIs(JLabel lblInterestIs) {
		this.lblInterestIs = lblInterestIs;
	}
}
